package com.designPatterns.proxy;

/**
 * 普通代理, 客户端只能访问代理角色,而不访问真是角色
 * Created by houjinxin on 16/3/29.
 */
public class StaticProxy2 implements ITarget2 {

    private ITarget2 target;

    public StaticProxy2(){
        target = new Target2(this);
    }

    @Override
    public void say(String word) {
        this.before();
        this.target.say(word);
        this.after();
    }

    private void before(){
        System.out.println("前置增强！");
    }

    private void after(){
        System.out.println("后置增强！");
    }
}
